package org.luxor.cloud.authentication.service.hystrix;

import org.luxor.cloud.authentication.service.IUserDetailsFeign;
import org.luxor.commons.core.web.RestStatus;
import org.luxor.commons.core.web.data.R;
import org.luxor.commons.security.entity.UserSubject;
import org.luxor.commons.security.utils.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 熔断实现
 *
 * @author Mr.Yan  @date: 2020/9/2
 */
@Component
public class UserDetailsHystrixImpl implements IUserDetailsFeign {
    private static Logger loger = LoggerFactory.getLogger(UserDetailsHystrixImpl.class);

    @Override
    public R<UserSubject> loadUserByUsername(String username) {
        loger.warn("loadUserByUsername Method Response Hystrix Data");
        return R.failed(RestStatus.FEIGN_HYSTRIX, SecurityUtils.ANONYMUS);
    }
}

